Carbon


KCSetData

Header: Keychain.h Carbon status: Under Evaluation

Sets or edits keychain item data.

OSStatus KCSetData (
    KCItemRef item, 
    UInt32 length, 
    const void *data
);
Parameter descriptions
item

A reference to the keychain item whose data you wish to set.

length

The length of the data buffer pointed to by the data parameter.

data

A pointer to a buffer containing the data to be stored in this item. Before calling KCSetData, allocate enough memory for the buffer to hold the data you want to store.

function result

A result code. The result code errKCInvalidItemRef indicates that the specified keychain item reference was invalid. The result code errKCDataTooLarge indicates that the data was too large for the supplied buffer. The result code errKCDataNotModifiable indicates that the data cannot be set for this item.

DISCUSSION

You can call KCSetData or the function KCSetAttribute to set or modify keychain item data. The difference between the functions is that KCSetAttribute requires that you pass the length of the data buffer as a field in a keychain item attribute structure rather than as a separate parameter.

If the keychain that contains the item is locked, before calling KCSetData you should call the function KCUnlock to prompt the user to unlock the keychain. The keychain must permit read/write access in order to modify keychain item data.

You can set or edit any of the standard item attributes identified by the following tag constants: kDescriptionKCItemAttr, kCommentKCItemAttr, kLabelKCItemAttr, kCreatorKCItemAttr, kTypeKCItemAttr, and kCustomIconKCItemAttr. There is additional data you can set, depending upon the type of keychain item whose data you are manipulating. See “Keychain Item Data Tag Constants” for more information.

VERSION NOTES

Available beginning with Keychain Manager 1.0.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)